
#include "GameEngine.h"

#include "OpenGLRenderer.h"
#include "WindowsInput.h"
#include "BasicWorld.h"
#include "String.h"

//(level 1 code)

class GameComponentFactory : public IGameComponentFactory
{
    
    String m_sRendererName;
    
public:
    
    GameComponentFactory(String sRendererName) : m_sRendererName(sRendererName)         {}
    
private:
    
    virtual IRenderer* createRenderer(Game* pOwner)
    {
        if (m_sRendererName == "OpenGL")
            return new OpenGLRenderer(pOwner);
        //else if (m_sRendererName == "DirectX9")
            //return new DirectX9Renderer();
        else {
            std::cerr << "Game component factory error: No object corresponding to renderer name " 
                            << m_sRendererName << ". Renderer creation failed." << std::endl;
            return 0;
        }
    }
    
    virtual IInput* createInput(Game* pOwner)
    {
        //#ifdef WIN32
            return new WindowsInput(pOwner);
        //#endif
    }
    
    virtual IAudio* createAudio(Game* pOwner)
    {
        //TODO: Implement this
        return 0;
    }
    
    virtual IWorld* createWorld(Game* pOwner)
    {
        return new BasicWorld(pOwner);
    }
    
};
